Hopefully this gets us working on RHEL6.
from . import builtins
from . import buildutil
from .ostbuildlog import log, fatal
+from .subprocess_helpers import run_sync, run_sync_get_output
class OstbuildAutodiscoverMeta(builtins.Builtin):
name = "autodiscover-meta"
def _discover_branch_from_git(self):
if os.path.isdir('.git'):
- try:
- try:
- ref = subprocess.check_output(['git', 'symbolic-ref', 'HEAD'], stderr=open('/dev/null', 'w'))
- return ref.replace('refs/heads/', '').strip()
- except subprocess.CalledProcessError, e:
- return subprocess.check_output(['git', 'describe', '--tags', '--exact-match', 'HEAD']).strip()
- except subprocess.CalledProcessError, e:
- return None
+ devnull=open('/dev/null', 'w')
+ ref = run_sync_get_output(['git', 'symbolic-ref', 'HEAD'], stderr=devnull, none_on_error=True)
+ if ref is not None:
+ return ref.replace('refs/heads/', '').strip()
+ ref = run_sync_get_output(['git', 'describe', '--tags', '--exact-match', 'HEAD'], stderr=devnull, none_on_error=True)
+ if ref is not None:
+ return ref
return None
builtins.register(OstbuildAutodiscoverMeta)
from . import builtins
from . import buildutil
from .ostbuildlog import log, fatal
-from .subprocess_helpers import run_sync
+from .subprocess_helpers import run_sync, run_sync_get_output
class OstbuildChrootCompileOne(builtins.Builtin):
name = "chroot-compile-one"
(args, rest_args) = parser.parse_known_args(argv)
if args.meta is None:
- output = subprocess.check_output(['ostbuild', 'autodiscover-meta'])
+ output = run_sync_get_output(['ostbuild', 'autodiscover-meta'])
self.metadata = json.loads(output)
else:
f = open(args.meta)
shutil.rmtree(child_tmpdir)
os.mkdir(child_tmpdir)
- rev = subprocess.check_output(['ostree', '--repo=' + args.repo, 'rev-parse', args.buildroot])
- rev=rev.strip()
+ rev = run_sync_get_output(['ostree', '--repo=' + args.repo, 'rev-parse', args.buildroot])
+ rev = rev.strip()
self.metadata['buildroot'] = args.buildroot
self.metadata['buildroot-version'] = rev
from . import builtins
from .ostbuildlog import log, fatal
-from .subprocess_helpers import run_sync
+from .subprocess_helpers import run_sync, run_sync_get_output
PREFIX = '/usr'
self.metadata = {}
if self.ostbuild_meta is None:
- output = subprocess.check_output(['ostbuild', 'autodiscover-meta'])
+ output = run_sync_get_output(['ostbuild', 'autodiscover-meta'])
self.metadata = json.loads(output)
else:
f = open(self.ostbuild_meta)